package com.janwen.spring.datasource.router;

import org.springframework.util.Assert;

public class DSKeyHolder {

	public static final ThreadLocal<DSType> DSHolder = new ThreadLocal<DSType>();
	
	
	public static void setDSKey(DSType dsType){
		Assert.notNull(dsType, "dsType can not be null");
		DSHolder.set(dsType);
	}
	
	public static DSType getDSKey(){
		return DSHolder.get();
	}
	
	
	public static void clearDSKey(){
		DSHolder.remove();
	}
}
